package com.AOP;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class AOP_qiemian {
    public static void main(String[] args) throws Throwable {
        Class c = Proxy.getProxyClass(Sell.class.getClassLoader(), Sell.class);
//        Proxy的代理，创建接口的代理类
        Constructor constructor =c.getConstructor(InvocationHandler.class);
        Sell sellProxyImp= (Sell) constructor.newInstance(new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                return null;
            }
        });
        System.out.println(c);
        String test = sellProxyImp.test();
        System.out.println(test);
    }


}
